{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "255e8b7a",
   "metadata": {},
   "source": [
    "## 1.数值\n",
    "> 1.对数值进行分类\n",
    ">> 1.整数（int）  \n",
    "\n",
    ">> 2.浮点型（float）  \n",
    "\n",
    ">> 3. 复数（complex）  \n",
    "\n",
    "> 2.数值的运算法则"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9d849fd9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99 <class 'int'>\n"
     ]
    }
   ],
   "source": [
    "## 整型\n",
    "a = 99\n",
    "print(a,type(a))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "8a658409",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99.9 <class 'float'>\n"
     ]
    }
   ],
   "source": [
    "## 浮点型\n",
    "b = 99.9\n",
    "print(b,type(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ef02fd16",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "198.9 <class 'float'>\n"
     ]
    }
   ],
   "source": [
    "c = a+b\n",
    "print(c,type(c))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f8b1abbe",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5 <class 'int'>\n"
     ]
    }
   ],
   "source": [
    "## 复数（虚数）\n",
    "d = 2+3\n",
    "print(d,type(d))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c8711fe4",
   "metadata": {},
   "outputs": [],
   "source": [
    "### 字符串（str）\n",
    "> 1.定义"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "760324d4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "18 18\n",
      "<class 'int'> <class 'str'>\n"
     ]
    }
   ],
   "source": [
    "a = 18\n",
    "b = '18'\n",
    "print(a,b)\n",
    "print(type(a),type(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "edba315c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"dosen't\""
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 关于单引号和双引号\n",
    "'dosen't'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "c3b71e4e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"dosen't\""
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#解决方法1\n",
    "\"dosen't\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "304970cc",
   "metadata": {},
   "outputs": [],
   "source": [
    "#解决方法2  \\ 后面的内容是“符号”，转义， \\自动消失"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1aed7d1f",
   "metadata": {},
   "outputs": [],
   "source": [
    "### 三个引号来代码注释\n",
    "import random\n",
    "import time\n",
    "\n",
    "南方学院学校要闻 = \"https://\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "506bf743",
   "metadata": {},
   "source": [
    "###  2.1字符串的运算法则\n",
    ">1.字符串的拼接  \n",
    ">2.<font color=\"red\">字符串的有序性</font>  \n",
    ">>2.1取值  \n",
    ">>2.2 切片  \n",
    ">3.enumerate:枚举  \n",
    ">4.in可以查询成员变量的"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "8445b97c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'helloworld'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 字符串的拼接\n",
    "\"hello\"+ \"world\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "ba04dcf9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "你好Alex\n",
      "你好Marry\n"
     ]
    }
   ],
   "source": [
    "# 实践\n",
    "text = \"你好\"\n",
    "for i in [\"Alex\",\"Marry\"]:\n",
    "    result = text+i\n",
    "    print(result)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "2d90b4a1",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 字符串的有序性\n",
    "地址 =\"广州市从化区温泉大道882号广州南方学院\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "19ffa6b8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'广州'"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "地址[0:2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "8888e449",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'州'"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "地址[1]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1a37af94",
   "metadata": {},
   "source": [
    "* 取值：\n",
    "> 1.取单个值\n",
    "> 2.切片，取多个连续的值"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "14771370",
   "metadata": {},
   "source": [
    "### 期中考试题"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "7400c7b6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "存在 广州 这个文本\n",
      "存在 广州 这个文本\n"
     ]
    }
   ],
   "source": [
    "# 实践：请检查广州是否在地址里面?\n",
    "#检查 i[index]是否是广，然后判断i[index+1]下一个索引值是否是州\n",
    "#方法：enumerate:枚举\n",
    "for index,value in enumerate(地址):\n",
    "    if value ==\"广\":\n",
    "        if 地址[index+1] ==\"州\":\n",
    "            print(\"存在 广州 这个文本\")\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "a29ddd6d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True\n",
      "False\n"
     ]
    }
   ],
   "source": [
    "# 方法：in可以查询成员变量的\n",
    "print(\"广州\" in 地址)\n",
    "print(\"Alex\" in 地址)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "0a4eaa47",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Alex\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 回去课后学习：\n",
    " ##1.首字母变大写\n",
    " ##   2.检查字符出现的错误\n",
    "print(\"Alex\".capitalize())\n",
    "地址.count(\"广州\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4e3ee7bc",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
